#include "gateway_server.hpp"
#include <gflags/gflags.h>

DEFINE_bool(log_mode, false, "运行模式： true-发布模式； false-测试模式");
DEFINE_string(log_file, "", "发布模式日志更新地址");
DEFINE_int32(log_level, 1, "默认日志等级");

DEFINE_int32(http_port, 23333, "http_port, 默认23333");

DEFINE_string(mysql_host, "120.76.98.215", "这是MySQL服务器的地址");
DEFINE_int32(mysql_port, 1314, "这是MySQL服务器的默认端口号");
DEFINE_int32(mysql_max_pool, 3, "这是MySQL连接池的最大连接数");
DEFINE_string(mysql_user, "zhiang_root", "这是登录用户名");
DEFINE_string(mysql_password, "123456Aa.", "这是登录用户密码");
DEFINE_string(mysql_db, "httpSystem", "这是数据库的库");
DEFINE_string(mysql_charset, "utf8", "这是数据库访问的编码格式");


int main(int argc, char* argv[]) {
    google::ParseCommandLineFlags(&argc, &argv, true);
    init_logger(FLAGS_log_mode, FLAGS_log_file, FLAGS_log_level);
    zhiang::GatewayBuilder gateway_builder;
    gateway_builder.make_mysql_client(FLAGS_mysql_user, FLAGS_mysql_password, FLAGS_mysql_db,
         FLAGS_mysql_host, FLAGS_mysql_port, FLAGS_mysql_charset, FLAGS_mysql_max_pool);
    gateway_builder.make_http_object(FLAGS_http_port);
    auto gateway_server = gateway_builder.build();
    gateway_server->start();
    return 0;
}

        
        
        
        
        
        
        